#include "UdpRecvTask.h"
#include "../types.h"

bool Call::UdpRecvTask::Create(const WS::UdpSocket &socket)
{
    this->m_udpSocket = socket;
    return true;
}

void Call::UdpRecvTask::Run()
{
    while (1)
    {
        using BufferType = CharBuf;
        BufferType buf;
        int len = m_udpSocket.Recv<BufferType>(buf);

        if (len > 0)
        {
            LOGI("recve CharBuf %d", buf.no);
        }
        else
        {
            LOGI("receive len error %d", len);
            break;
        }
    }
}